<template>
  <el-card>
    <!--搜索组件-->
    <search-device :company-search="companySearchForm" @onSearch="onSearch"/>
    <!--按钮组件-->
    <company-option-btn />
    <!-- 分隔符 -->
    <hr />
    <!-- 数据展示 -->
    <company-data :form-definition="companyDataPageForm" :data="tableData.result"/>
    <!-- 数据分页 -->
    <page :total="tableData.total"/>
    <router-view/>
  </el-card>
</template>

<script>
import searchDevice from "./companySearch.vue";
import companyOptionBtn from "./companyOptionBtn.vue";
import companyData from "./companyData.vue";
import page from "@/components/common/page.vue";
import { companySearchForm } from "./entity/companySearch";
import { companyDataPageForm } from './entity/companyDataForm';
import {getCompanyPage} from '@/api/system/companyApi'
export default {
  components: { searchDevice, companyOptionBtn, companyData, page },
  data() {
    return {
      companySearchForm,
      companyDataPageForm,
      tableData:{}
    };
  },
  methods:{
    loadCompanyPageData(){
      getCompanyPage(this.companySearchForm).then(data=>{
        this.tableData = data;
      }).catch(err=>{
        this.$message.error(err);
      })
    },
    onSearch(){
        console.log('执行搜索',this.companySearchForm)
    }
  },
  mounted(){
    this.loadCompanyPageData();
  }
};
</script>

<style scoped lang="scss"></style>
